package cn.pet.service.manage.mapper;

import cn.pet.service.manage.entity.vo.OrderSendingList;
import cn.pet.service.manage.entity.vo.SubscribeApprovingList;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author zwr
 * @version 1.0
 * @description TODO
 * @date 2023/3/6 20:09
 */
public interface StatMapper {

    @Select("select count(1) from pet_user where user_type=1")
    Integer memberCount();

    @Select("select count(1) from pet_user where user_type=1 and status = 1")
    Integer memberNotUseCount();

    @Select("select count(1) from pet_user where user_type=2")
    Integer employeeCount();

    @Select("select count(1) from pet_order where status = 4")
    Integer shopOrderFinishedCount();

    @Select("select count(1) from pet_comment")
    Integer goodsCommentCount();


    @Select("select count(1) from pet_order")
    Integer shopOrderCount();

    @Select("select count(1) from pet_subscribe where status=0")
    Integer subscribeServiceApprovingCount();

    @Select("select count(1) from pet_subscribe where status=1")
    Integer subscribeServiceApprovedCount();

    @Select("select count(1) from pet_subscribe where status=2")
    Integer subscribeServiceApprovedFailCount();

    @Select("select count(1) from pet_subscribe where status in (0,3,4)")
    Integer subscribeServiceSubmitCount();
    @Select("select count(1) from pet_subscribe_order")
    Integer subscribeOrderCount();

    @Select("select count(1) from pet_subscribe")
    Integer subscribeCount();

    @Select("select count(1) from pet_goods where status=0")
    Integer goodsUsingCount();

    @Select("select count(1) from pet_goods where status=1")
    Integer goodsUNotUseCount();

    @Select("select ps.id,ps.name,ps.subscribe_start_time,ps.subscribe_end_time,pu.real_name from pet_subscribe  ps\n" +
            "    left join pet_user pu on ps.user_id = pu.id\n" +
            "    where ps.status=0 order by ps.create_time desc")
    List<SubscribeApprovingList> listSubApprovingLists();


    @Select("select po.id,po.money,pu.real_name,po.create_time from pet_order po\n" +
            "    left join pet_user pu on po.user_id = pu.id\n" +
            "    where po.status =1 order by po.create_time desc")
    List<OrderSendingList> listOrderSendingLists();

}
